﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<style type="text/css">
    .ui-jqgrid .table-bordered th {
        height: 52px !important;
    }
</style>
<script type="text/javascript">
    $(function () {
        initControl();
        gridList();
    });
    function initControl() {
        $('select').bindSelect();
    }
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/BOM/Product/GetStampingListJson",
            height: $(window).height() - 134,
            colModel: [
                { label: '零部件号', name: 'FProductionNO', width: 120, align: 'left', sortable: false, frozen: true },
                { label: '零件名称', name: 'MC', width: 240, align: 'left', sortable: false, frozen: true },
                { label: '装配<br />路线', name: 'AssembleLine', width: 40, align: 'left', sortable: false },
                { label: '制造路线', name: 'MakeLine', width: 180, align: 'left', sortable: false },
                @foreach (var item in ViewBag.orderList) {
                    @Html.Raw("{ label: '" + @item.ProductNO2 + "', name: 'SL" + @item.OrderNum.ToString("000") + "', width: 70, align: 'right', sortable: false, formatter: function (cellvalue) { return cellvalue > 0 ? cellvalue : '';} },");
                }
                @if (ViewBag.orderList.Count <= 7){
                         @Html.Raw("{ label: '备注', name: '', width: 180, align: 'center', sortable: false }");
                }
            ],
            pager: "#gridPager",
            sortname: 'FProductionNO asc',
            viewrecords: true,
            rownumWidth: 40,
            loadComplete: function () {
                $gridList.jqGrid('setSelection', 1);
            },
            onSelectRow: function (rowId) {
                //alert(rowId);
            }
        });
        $gridList.jqGrid('setLabel', 0, '序号', 'rowNumberHeaderStyle');
        $gridList.jqGrid('setFrozenColumns');
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                postData: { number: $("#txtNumber").val(), name: $("#txtName").val(), assemble: $("#txtAssemble").val(), make: $("#txtMake").val() },
            }).trigger('reloadGrid');
        });
    }
    function btn_add() {
        $.detailOpen({
            id: "Detail",
            title: "",
            url: "/BOM/Product/ArrangeComponentInput"
        });
    }
</script>
<div id="layout" style="height: 100%; width: 100%;">
    <form id="form1">
        <div style="padding: 12px 0 5px 0; padding-left: 15px; border-bottom: 1px solid #ccc; " class="line-table input-width-105">
            <div class="btn-group" style="margin-top:-9px;">
                零件编号<br /><input id="txtNumber" name="txtNumber" type="text" class="form-control" /> &nbsp;
            </div>
            <div class="btn-group" style="margin-top:-9px;">
                零件名称<br /><input id="txtName" name="txtName" type="text" class="form-control input-width-185" /> &nbsp;
            </div>
            <div class="btn-group" style="margin-top:-9px;">
                装配路线<br /><input id="txtAssemble" name="txtAssemble" type="text" class="form-control input-width-40" /> &nbsp;
            </div>
            <div class="btn-group" style="margin-top:-9px;">
                制造路线<br /><input id="txtMake" name="txtMake" type="text" class="form-control" /> &nbsp;
            </div>
            <div class="btn-group" style="">
                <a id="btn_search" class="btn btn-primary center-block" onclick=""><span class="glyphicon glyphicon-search"></span> 检索</a>
            </div>
            <div class="btn-group" style="float:right;">
                <a id="" class="btn btn-primary center-block" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span> 刷新</a>
                <a id="" class="btn btn-primary center-block" onclick="btn_add()"><span class="glyphicon glyphicon-pencil"></span> 计算</a>                
                <a id="" class="btn btn-primary center-block disabled" onclick=""><span class="glyphicon glyphicon-download"></span> 导出</a>
            </div>
        </div>
    </form>
    <div style="">
        <table id="gridList"></table>
        <div id="gridPager"></div>
    </div>
</div>

